# Copyright 2013 Lou Parslow
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#
#
require 'rubygems'
require 'systemu'

require './lib/b2.rb'

task :info do
  puts "DEV_HOME " << B2.dev_home
end

task :doc do
  puts `rdoc ./lib`
end

task :test do
  puts "begin test task"

  puts "testing if svn command is available"
  result = B2.cmd_available? "svn"
  puts "result=#{result.to_s}"
  puts "testing if bogus is available"
  result = B2.cmd_available? "bogus"
  puts "result=#{result.to_s}"

  B2.install
  #version = `b2 --version`
  B2.uninstall
  puts "checking if b2 command is available"
  status,stdout,stderr=systemu("b2 --version")
  puts "b2 command is not available" if status != 0
  puts "status=" + status.to_s
  
  puts "stdout:"
  puts stdout
  puts "stderr:"
  puts stderr
  begin
    result = system("b2 --version")
  rescue
   puts "version = " + version
  end
  puts "end test task"
end

task :compile do
  puts `gem build boost_build.gemspec`
end

task :default =>[:info,:test,:compile,:doc] do
end
